#pragma once
#include <iostream>
#include <vector>
#include <unordered_map>
#include <functional>
#include <unistd.h>

using func = std::function<void()>;
std::vector<func> callTasks;
std::unordered_map<int, std::string> desc;

// 任务：（各函数实现）
void readMySQL()
{
    std::cout << "【child process-" << getpid() << " 】 :执行访问数据库的任务\n"
              << std::endl;
}

void execuleUrl()
{
    std::cout << "【child process-" << getpid() << " 】 :执行url解析\n"
              << std::endl;
}

void cal()
{
    std::cout << "【child process-" << getpid() << " 】 :执行加密任务\n"
              << std::endl;
}

void save()
{
    std::cout << "【child process-" << getpid() << " 】 执行数据持久化任务\n"
              << std::endl;
}

void Load()
{
    desc.insert({callTasks.size(), "readMySQL:读取数据库"});
    callTasks.push_back(readMySQL);

    desc.insert({callTasks.size(), "execuleUrl:进行url解析"});
    callTasks.push_back(execuleUrl);

    desc.insert({callTasks.size(), "cal:进行加密"});
    callTasks.push_back(cal);

    desc.insert({callTasks.size(), "saveL:进行数据持久化"});
    callTasks.push_back(save);
}


int TaskNumber()
{
    return desc.size();
}